<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>修改DOM节点样式练习</title>
    <style>
      .cl {
        font-size: 14px;
        color: green;
      }
    </style>
  </head>
  <body>
    <p id="text">JavaScript DOM 编程</p>
    <input type="button" value="改变样式" onclick="changeStyle()" />
    <script>
      const button = document.querySelector("p");
      function changeStyle() {
        button.classList.toggle("cl");
      }
    </script>
  </body>
</html>
